package com.cdm.persistence;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CdmContentState entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "CDM_CONTENT_STATE", catalog = "CDM", uniqueConstraints = {})
public class ContentState implements java.io.Serializable {
	private static final long serialVersionUID = -5163419023309804394L;

	// Fields

	@Id
	@Column(name = "dcid", unique = true, nullable = false, insertable = true, updatable = true)
	private Long dcid;
	@Column(name = "content_state", unique = false, nullable = false, insertable = true, updatable = true)
	private Integer contentState;
	@Temporal(TemporalType.DATE)
	@Column(name = "decrypt_time", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
	private Date decryptTime;
	@Temporal(TemporalType.DATE)
	@Column(name = "transcoding_time", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
	private Date transcodingTime;
	@Temporal(TemporalType.DATE)
	@Column(name = "encrypt_time", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
	private Date encryptTime;
	@Column(name = "encrypt_count", unique = false, nullable = false, insertable = true, updatable = true)
	private Long encryptCount = 0l;

	public static final int INITIAL = 0;
	public static final int DECRYPTED = 1;
	public static final int TRANSCODED = 2;
	public static final int ENCRYPTED = 3;

	public String getStateName() {
		Integer state = this.contentState;
		if (state == 0) {
			return "未解密";
		} else if (state == 1) {
			return "已解密";
		} else if (state == 2) {
			return "已转码";
		} else if (state == 3) {
			return "已加密";
		} else {
			return state.toString();
		}
	}
	public String getToDoName() {
		Integer state = this.contentState;
		if (state == 0) {
			return "解密";
		} else if (state == 1) {
			return "转码";
		} else if (state == 2) {
			return "加密";
		} else if (state == 3) {
			return "";
		} else {
			return state.toString();
		}
	}

	// Constructors

	/** default constructor */
	public ContentState() {
	}

	/** minimal constructor */
	public ContentState(Long dcid, Integer contentState) {
		this.dcid = dcid;
		this.contentState = contentState;
	}

	// Property accessors
	public Long getDcid() {
		return this.dcid;
	}

	public void setDcid(Long dcid) {
		this.dcid = dcid;
	}

	public Integer getContentState() {
		return this.contentState;
	}

	public void setContentState(Integer contentState) {
		this.contentState = contentState;
	}

	public Date getDecryptTime() {
		return this.decryptTime;
	}

	public void setDecryptTime(Date decryptTime) {
		this.decryptTime = decryptTime;
	}

	public Date getTranscodingTime() {
		return this.transcodingTime;
	}

	public void setTranscodingTime(Date transcodingTime) {
		this.transcodingTime = transcodingTime;
	}

	public Date getEncryptTime() {
		return this.encryptTime;
	}

	public void setEncryptTime(Date encryptTime) {
		this.encryptTime = encryptTime;
	}

	public Long getEncryptCount() {
		return this.encryptCount;
	}

	public void setEncryptCount(Long encryptCount) {
		this.encryptCount = encryptCount;
	}

}